//
//  HZL_StateTableViewCell.m
//  B_Project
//
//  Created by 刘峻豪 on 15/11/28.
//  Copyright © 2015年 HZL. All rights reserved.
//

#import "HZL_StateTableViewCell.h"
#import "UIImageView+WebCache.h"
@interface HZL_StateTableViewCell ()
@property (nonatomic, strong)UIImageView *topImage;
@property (nonatomic, strong)UILabel *titleLabel;
@property (nonatomic, strong)UILabel *detailLabel;
@end
@implementation HZL_StateTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.topImage = [[UIImageView alloc]init];
        self.topImage.contentMode = UIViewContentModeScaleAspectFill;
        self.topImage.clipsToBounds = YES;
        [self.contentView addSubview:self.topImage];
        
        self.titleLabel = [[UILabel alloc]init];
        self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
        [self.contentView addSubview:self.titleLabel];
        
        self.detailLabel = [[UILabel alloc]init];
        self.detailLabel.numberOfLines = 2;
        self.detailLabel.textColor = [UIColor grayColor];
        self.detailLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.detailLabel];
        
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];

    self.topImage.frame = CGRectMake(10, 5, 170, 100);
    self.titleLabel.frame = CGRectMake(190, 10, self.contentView.frame.size.width - 180, 30);
    self.detailLabel.frame = CGRectMake(190, 40, self.contentView.frame.size.width - 190, 70);
    

}
- (void)setModel:(HZL_StoreModel *)model
{
    [self.topImage sd_setImageWithURL:[NSURL URLWithString:model.img]];
    self.titleLabel.text = model.title;
    self.detailLabel.text = model.descr;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
